/*******************************************************************************
 * NEW TOPIC FORM
 * 
 * Copyright:
 * 
 * License:
 * 
 * Authors: SALMON Charles
 * 
 ******************************************************************************/

/*******************************************************************************
 * 
 ******************************************************************************/

/**
 * Create a new topic
 */
qx.Class.define("bip.ui.topics.NewTopicForm",
{
  extend : qx.ui.form.Form,
  
  construct : function(updateMode)
  {
	if (updateMode == null) {updateMode = false;}
	this.__updateMode = updateMode;
	
    this.base(arguments);
    // Add fields
    // IdLocal
    var localSelectfield = new bip.ui.form.LocalSelectBox();
    this.add(localSelectfield, "IdLocal", null, "idLocal");
    if (updateMode) {localSelectfield.exclude();}
    // TopicId
    var topicIdField = new qx.ui.form.Spinner();
    topicIdField.set({maximum: 10000,minimum: 0});
    topicIdField.exclude();
    this.add(topicIdField, "IdTopic", null, "idTopic");
    // Name
    var nameTextfield = new qx.ui.form.TextField();
    nameTextfield.setRequired(true);
    nameTextfield.setWidth(100);
    this.add(nameTextfield, "Name", null, "name");
    // Description
    var descTextfield = new qx.ui.form.TextField();
    descTextfield.setWidth(200);
    descTextfield.setRequired(true);
    this.add(descTextfield, "Description", null, "description");
    
  },
  
	/*
	 *****************************************************************************
    MEMBERS
	 *****************************************************************************
	 */

 	members :
 	{
 		__updateMode: false,
 		__applyButton: null,
 		
 		getApplyButton: function() {
 			return this.__applyButton;
 		}
 		
 	},
 	
	/*
	 * ****************************************************************************
	 * DESTRUCTOR
	 * ****************************************************************************
	 */

	destruct : function() {
		this._disposeObjects("__applyButton");
	}

  
});